#pragma once
#include "MeshPassProcessor.h"
namespace Alice
{
    class FBasePassMeshProcessor : public FMeshPassProcessor
    {
    public:
        enum class EFlags
        {
            None = 0,
            // Informs the processor whether a depth-stencil target is bound when processed draw commands are issued.
            CanUseDepthStencil = (1 << 0),
            bRequires128bitRT = (1 << 1)
        };
        FMeshPassProcessorRenderState PassDrawRenderState;
        const ETranslucencyPass::Type TranslucencyPassType;
        const bool bTranslucentBasePass;
        const bool bOITBasePass;
        const bool bEnableReceiveDecalOutput;
        EDepthDrawingMode EarlyZPassMode;
        bool bRequiresExplicit128bitRT;
        float AutoBeforeDOFTranslucencyBoundary = 0.0f;
        FBasePassMeshProcessor(
            EMeshPass::Type InMeshPassType,
            const Scene* InScene,
            const SceneView* InViewIfDynamicMeshCommand,
            const FMeshPassProcessorRenderState& InDrawRenderState,
            FMeshPassDrawListContext* InDrawListContext,
            EFlags Flags,
            ETranslucencyPass::Type InTranslucencyPassType = ETranslucencyPass::TPT_MAX);

        virtual void AddMeshBatch(const FMeshBatch& MeshBatch, uint64 BatchElementMask, const PrimitiveSceneProxy* PrimitiveSceneProxy, int32 StaticMeshId = -1) override final;
        bool TryAddMeshBatch(const FMeshBatch& MeshBatch, uint64 BatchElementMask, const PrimitiveSceneProxy* PrimitiveSceneProxy, int32 StaticMeshId, const MaterialRenderProxy& MaterialRenderProxy, const MaterialShared& Material);
        bool ShouldDraw(const MaterialShared& Material);
	
        template<typename LightMapPolicyType>
        bool Process(
            const FMeshBatch& MeshBatch,
            uint64 BatchElementMask,
            int32 StaticMeshId,
            const PrimitiveSceneProxy* PrimitiveSceneProxy,
            const MaterialRenderProxy& MaterialRenderProxy,
            const MaterialShared& MaterialResource,
            const bool bIsMasked,
            const bool bIsTranslucent,
            FMaterialShadingModelField ShadingModels,
            const LightMapPolicyType& LightMapPolicy,
            const typename LightMapPolicyType::ElementDataType& LightMapElementData,
            ERasterizerFillMode MeshFillMode,
            ERasterizerCullMode MeshCullMode);
    };
    ENUM_CLASS_FLAGS(FBasePassMeshProcessor::EFlags);
}